import Mock from 'mockjs'

export default {
    getMenu:config=>{
        const {username,password}=JSON.parse(config.body)
        if(username=='admin'&&password=='admin'){
            return {
                code:20000,
                data:{
                    menu:[
                        {
                            path: '/',
                            name: 'home',
                            label:'首页',
                            icon:'s-home',
                            url:'home/index'
                        },
                        {
                            path: '/mall',
                            name: 'mall',
                            label:'商品管理',
                            icon:'video-play',
                            url:'Mall/index'
                        },
                        {
                            path: '/user',
                            name: 'user',
                            label:'用户管理',
                            icon:'user',
                            url:'user/index'
                        },
                        {
                            path: '/Other',
                            name: 'Other',
                            label:'其他',
                            icon:'location',
                            url:'Other/Other',
                            children:[
                                {
                                    path:'/PageOne',
                                    name: "PageOne",
                                    label:'页面1',
                                    icon:'setting',
                                    url:'Other/PageOne'
                                },
                                {
                                    path:'/PageTwo',
                                    name: "PageTwo",
                                    label:'页面2',
                                    icon:'setting',
                                    url:'Other/PageTwo'
                                },
                            ]
                        },
                    ],
                    token:Mock.Random.guid(),
                    message:'获取成功'
                }
            }
        }else if(username=='xiaoxiao'&&password=='xiaoxiao'){
            return {
                code:20000,
                data:{
                    menu:[
                        {
                            path: '/',
                            name: 'home',
                            label:'首页',
                            icon:'s-home',
                            url:'home/index'
                        },
                        {
                            path: '/video',
                            name: 'video',
                            label:'商品管理',
                            icon:'video-play',
                            url:'mall/index'
                        },
                    ],
                    token:Mock.Random.guid(),
                    message:'获取成功'
                }
            }
        }else{
            return {
                code:-999,
                data:{
                    message:'密码错误'
                }
            }
        }
    }
}